//
//  SeniorityDataModel.m
//  NewMusic
//
//  Created by chuxinyu123 on 15/11/14.
//  Copyright © 2015年 Going. All rights reserved.
//

#import "SeniorityDataModel.h"

@implementation SeniorityDataModel

- (void)dealloc
{
    [_songlist_id release];
    [_songs release];
    [_ranklist_id release];
    [_image release];
    [_title release];
    [_sub_title release];
    [super dealloc];
}
- (instancetype)initWithDictionary:(NSDictionary *)dictionary
{
    self = [super init];
    if (self) {
        self.songs = [NSMutableArray array];
        [self setValuesForKeysWithDictionary:dictionary];
    }
    return self;
}

+ (SeniorityDataModel *)seniorityDataModelWithDictionary:(NSDictionary *)dictionary
{
    SeniorityDataModel *seniorityDataModel = [[SeniorityDataModel alloc] initWithDictionary:dictionary];
    return [seniorityDataModel autorelease];
}

- (void)setValue:(id)value forUndefinedKey:(NSString *)key
{
    
}

- (void)setValue:(id)value forKey:(NSString *)key
{
    if ([key isEqual:@"songlist_id"]) {
        self.songlist_id = [NSString stringWithFormat:@"%@", value];
    }else if ([key isEqual:@"ranklist_id"]) {
        self.ranklist_id = [NSString stringWithFormat:@"%@", value];
    }else if ([key isEqual:@"songs"]) {
        for (NSDictionary *dictionary in value) {
            SenioritySongsDataModel *senioritySongsDataModel = [SenioritySongsDataModel senioritySongsDataModelWithDictionary:dictionary];
            [_songs addObject:senioritySongsDataModel];
        }
    }else if ([key isEqual:@"image"]) {
        self.image = [value objectForKey:@"pic"];
    }else{
        [super setValue:value forKey:key];
    }
}

@end
